
import { RouteRecord, RouteRecordRaw, createRouter, createWebHashHistory, createWebHistory } from 'vue-router'

import Guide from '../pages/Guide/Guide.vue'
import { ErrorRoutes } from './../pages/BadPage/route';
import { ShopRoutes } from './../pages/Shop/route';
import { LoginRoutes } from '../pages/Logins/route';
import { GoodRoutes } from '../pages/Good/GoodRoutes';

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        redirect: '/shop',
    },
    ...ShopRoutes,
    ...LoginRoutes,
    ...GoodRoutes,
    {
        path: '/guide',
        component: Guide,
    },
    ...ErrorRoutes,
    {
        path: '/:pathMatch(.*)',  // 错误页面铺抓
        redirect: '/404'
    }
]

const router: any = createRouter({
    history: createWebHashHistory(),  // hash 模式 
    routes
})

export default router;

